<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Filter Effects Module Level 1: parsing filter with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/filter-effects/#FilterProperty">
<meta name="assert" content="filter supports the full grammar 'none | <filter-function-list>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("filter", "none");

test_valid_value("filter", "blur(100px)");
test_valid_value("filter", "blur(0)", "blur(0px)");
test_valid_value("filter", "blur()", ["blur()", "blur(0px)"]);

test_valid_value("filter", "brightness(0)");
test_valid_value("filter", "brightness(300%)");
test_valid_value("filter", "brightness()", ["brightness()", "brightness(1)"]);

test_valid_value("filter", "contrast(0)");
test_valid_value("filter", "contrast(300%)");
test_valid_value("filter", "contrast()", ["contrast()", "contrast(1)"]);

test_valid_value("filter", "drop-shadow(1px 2px)");
test_valid_value("filter", "drop-shadow(1px 2px 3px)");
test_valid_value("filter", "drop-shadow(0 0 0)", "drop-shadow(0px 0px 0px)");
// https://github.com/w3c/fxtf-drafts/issues/240
test_valid_value("filter", "drop-shadow(rgb(4, 5, 6) 1px 2px)");
test_valid_value("filter", "drop-shadow(1px 2px rgb(4, 5, 6))", "drop-shadow(rgb(4, 5, 6) 1px 2px)");
test_valid_value("filter", "drop-shadow(rgba(4, 5, 6, 0.75) 1px 2px 3px)");

test_valid_value("filter", "grayscale(0)");
test_valid_value("filter", "grayscale(300%)", "grayscale(100%)");
test_valid_value("filter", "grayscale()", ["grayscale()", "grayscale(1)"]);

test_valid_value("filter", "hue-rotate(90deg)");
test_valid_value("filter", "hue-rotate(0)", "hue-rotate(0deg)"); // https://github.com/w3c/fxtf-drafts/issues/228
test_valid_value("filter", "hue-rotate()", ["hue-rotate()", "hue-rotate(0deg)"]);

test_valid_value("filter", "invert(0)");
test_valid_value("filter", "invert(300%)", "invert(100%)");
test_valid_value("filter", "invert()", ["invert()", "invert(1)"]);

test_valid_value("filter", "opacity(0)");
test_valid_value("filter", "opacity(300%)", "opacity(100%)");
test_valid_value("filter", "opacity()", ["opacity()", "opacity(1)"]);

test_valid_value("filter", "saturate(0)");
test_valid_value("filter", "saturate(300%)");
test_valid_value("filter", "saturate()", ["saturate()", "saturate(1)"]);

test_valid_value("filter", "sepia(0)");
test_valid_value("filter", "sepia(300%)", "sepia(100%)");
test_valid_value("filter", "sepia()", ["sepia()", "sepia(1)"]);

// Edge serializes url(...) without quotes. Blink/WebKit and Firefox use quotes.
test_valid_value("filter", "url(picture.svg#f)", ['url("picture.svg#f")', 'url(picture.svg#f)']);

test_valid_value("filter", 'url("https://www.example.com/picture.svg#f")',
  ['url("https://www.example.com/picture.svg#f")', 'url(https://www.example.com/picture.svg#f)']);

test_valid_value("filter", 'blur(10px) url("picture.svg#f") contrast(20) brightness(30)',
  ['blur(10px) url("picture.svg#f") contrast(20) brightness(30)', 'blur(10px) url(picture.svg#f) contrast(20) brightness(30)']);
</script>
</body>
</html>
